package hu.stud.uszeged.inf.prf.prftrac.session.dao;

import java.util.List;

import hu.stud.uszeged.inf.prf.prftrac.entity.Milestone;
import hu.stud.uszeged.inf.prf.prftrac.entity.Project;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

@Name("milestoneDao")
public class MilestoneDao {
	
	@In
	private EntityManager entityManager;
	
	@SuppressWarnings("unchecked")
	public List<Milestone> getMilestonesByProject(Project p) {
    	String queryString = "from Milestone m where m.project = :pro";
    	Query q = entityManager.createQuery(queryString);
    	q.setParameter("pro", p);
    	return (List<Milestone>)q.getResultList();
    }
}
